package com.numbfish.ch81_ex02_selenium_official_start.test;


import com.numbfish.ch81_ex02_selenium_official_start.DriverBase;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.WebDriverWait;

import java.net.MalformedURLException;
import java.time.Duration;
import java.util.List;

public class GetElement extends DriverBase {

    private RemoteWebDriver driver;

    @BeforeEach
    public void setup() throws MalformedURLException {
        driver = getDriver();
    }

    @Test
    public void baiduExampleThatSearchesFor() {
       driver.get("https://docs.spring.io/spring-boot/docs/3.2.5/gradle-plugin/reference/htmlsingle/");
        List<WebElement> elements = driver.findElements(By.className("sectlevel1 expanded"));
        elements.forEach(element -> {
            System.out.println(element.getText());
        });
    }


}
